home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / flilib.zip / FLIDOC.TXT < prev    next >
Text File  |  1990-02-20  |  45KB  |  1,334 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.                 Turbo C FLI Library Documentation
  13.            For FLI Files Created by Autodesk Animator
  14.  
  15.                         November 20, 1989
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. Copyright 1989-1990 Dancing Flame, San Francisco
  51. Program Code and Library by Jim Kent
  52. Documentation by Jim Kent and Heidi Brumbaugh
  53.  
  54.                        Turbo C FLI Library
  55.                         Table of Contents
  56.  
  57.  
  58.  
  59.  
  60.  
  61. 1. Introduction to the Turbo C FLI library. . . . . . . . . .   1
  62.  
  63. 2. Sample FLI programs. . . . . . . . . . . . . . . . . . . .   1
  64.      2.1 PLAY.C . . . . . . . . . . . . . . . . . . . . . . .   1
  65.      2.2 ALLFLIS.C. . . . . . . . . . . . . . . . . . . . . .   2
  66.      2.3 SLICEFLI.C . . . . . . . . . . . . . . . . . . . . .   3
  67.  
  68. 3. Usage of FLI routines. . . . . . . . . . . . . . . . . . .   5
  69.      3.1 Playback Routines. . . . . . . . . . . . . . . . . .   5
  70.      3.2 Save Routines. . . . . . . . . . . . . . . . . . . .   6
  71.  
  72. 4. VGA Graphics Support . . . . . . . . . . . . . . . . . . .   7
  73.  
  74. 5. MS-DOS Support . . . . . . . . . . . . . . . . . . . . . .   8
  75.  
  76. 6. The FLILIB header files. . . . . . . . . . . . . . . . . .  10
  77.      6.1 AAFLISAV.H . . . . . . . . . . . . . . . . . . . . .  10
  78.      6.2 AAFLI.H. . . . . . . . . . . . . . . . . . . . . . .  11
  79.      6.3 AATYPES.H  . . . . . . . . . . . . . . . . . . . . .  13
  80.      6.4 AADOS.H. . . . . . . . . . . . . . . . . . . . . . .  14
  81.      6.5 AAERR.H. . . . . . . . . . . . . . . . . . . . . . .  16
  82.      6.6 AASCREEN.H . . . . . . . . . . . . . . . . . . . . .  16
  83.  
  84. 8. Autodesk Animator files. . . . . . . . . . . . . . . . . .  18
  85.      8.1 Flic Files (.FLI). . . . . . . . . . . . . . . . . .  18
  86.      8.2 Picture Files (.GIF) . . . . . . . . . . . . . . . .  21
  87.      8.3 Cel Files (.CEL and .PIC). . . . . . . . . . . . . .  21
  88.      8.4 Palette Files (.COL) . . . . . . . . . . . . . . . .  22
  89.      8.5 Mask Files (.MSK). . . . . . . . . . . . . . . . . .  22
  90.      8.6 Text Files (.TXT). . . . . . . . . . . . . . . . . .  22
  91.      8.7 Font Files (.FNT). . . . . . . . . . . . . . . . . .  22
  92.      8.8 Polygon and Path files (.PLY). . . . . . . . . . . .  24
  93.      8.9 Optics Files (.OPT). . . . . . . . . . . . . . . . .  24
  94.      8.10 Record Files (.REC) . . . . . . . . . . . . . . . .  24
  95.  
  96.  
  97. 1. Introduction to the Turbo C FLI library
  98.  
  99.      FLI.LIB is a Turbo C large model library for manipulating 
  100. Autodesk Animator FLI files.  It also contains some general-
  101. purpose MS-DOS functions and a few VGA graphics primitives.
  102.  
  103.      The main Turbo C library is contained in the file FLI.LIB. 
  104. Additionally, you will need to include the header file AAFLI.H to
  105. read a FLI file and AAFLISAV.H to save a FLI file.  AAFLI.H will 
  106. include the additional files AATYPES.H, AADOS.H, AAERR.H and
  107. AASCREEN.H if they are not already included.  AAFLISAV.H will
  108. include AAFLI.H if it is not already included.
  109.  
  110.      The 58 source file routines to load or save a FLI are in the
  111. folder LIBSOURC; however, these modules are not necessary as they
  112. are already included in FLI.LIB.
  113.  
  114.      Your disk also includes three sample C files to load and
  115. play a FLI file.  The sample batch file which compiles these
  116. files in Turbo C is:
  117.  
  118. tcc -ml play.c fli.lib 
  119. tcc -ml allflis.c fli.lib 
  120. tcc -ml slicefli.c fli.lib
  121.  
  122.      In sum, the files you will need to use the Turbo C FLI
  123. library are:
  124.  
  125. AATYPES.H
  126. AADOS.H
  127. AAERR.H
  128. AASCREEN.H
  129. AAFLI.H
  130. AAFLISAV.H
  131. FLI.LIB
  132.  
  133. 2. Sample FLI programs
  134.  
  135.      Once the header files are included in your code and your
  136. make file is set up to properly link your program with the
  137. library, calling the high-level FLI routines is very
  138. straightforward.  In fact, the sample programs show that you can
  139. write a program to play back a FLI in about twenty-five lines --
  140. and most of that code is to verify that a VGA is connected!
  141.  
  142. 2.1 PLAY.C
  143.  
  144. This program will play a FLI file until a key is pressed.
  145.  
  146. #include "aafli.h" 
  147.  
  148. main(int argc, char *argv[]) 
  149. int ivmode; 
  150. Errval err; 
  151. if (argc != 2)   /* If command line looks wrong give a little help */
  152.  
  153.    { 
  154.    puts("Play will play a FLI file until a key is hit"); 
  155.    puts("Example usage: play pretty.fli"); 
  156.    } 
  157. else 
  158.    { 
  159.    ivmode = dos_get_vmode();  /* Get video mode to restore at exit */ 
  160.    dos_set_vmode(0x13);       /* Go into 320x200 256 color mode */ 
  161.    if (dos_get_vmode() == 0x13) 
  162.       { 
  163.       err = fli_play(argv[1]); 
  164.       dos_set_vmode(ivmode); 
  165.       if (err < AA_SUCCESS) 
  166.          puts(fli_error_message(err) ); 
  167.       } 
  168.    else 
  169.       puts("Not a VGA/MCGA display"); 
  170.    } 
  171.  
  172. 2.2 ALLFLIS.C
  173.  
  174. This program plays all the FLI files in the current directory
  175. once and exits.
  176.  
  177. #include "aafli.h" 
  178.  
  179. main() 
  180. Fndata *fn; 
  181. int ivmode; 
  182. Errval err; 
  183.  
  184. fn = dos_get_dta(); 
  185. if (dos_first("*.FLI", DOS_ATTR_NORMAL)) 
  186.    { 
  187.    ivmode = dos_get_vmode(); 
  188.    dos_set_vmode(0x13); 
  189.    if (dos_get_vmode() == 0x13) 
  190.       { 
  191.       for (;;) 
  192.          { 
  193.          if (dos_key_is()) /* check keyboard to abort between FLI's */
  194.             { 
  195.             dos_key_in(); 
  196.             break; 
  197.             } 
  198.          err = fli_once(fn->name); 
  199.          if (err < AA_SUCCESS) 
  200.             {  puts(fli_error_message(err)); 
  201.             } 
  202.          if (!dos_next()) 
  203.             break; 
  204.          } 
  205.       dos_set_vmode(ivmode); 
  206.       } 
  207.    else 
  208.       { 
  209.       puts("Not a VGA/MCGA display"); 
  210.       } 
  211.    } 
  212. else 
  213.    { 
  214.    puts("No .FLI files"); 
  215.    } 
  216.  
  217. 2.3 SLICEFLI.C
  218.  
  219. This program cuts out every other line of a FLI file, creating a
  220. new FLI.
  221.  
  222. #include "aaflisav.h" 
  223.  
  224. main(int argc, char *argv[]) 
  225. int i; 
  226. Errval err; 
  227. int ivmode; 
  228.  
  229. if (argc != 3) 
  230.    { 
  231.    puts("slicefli - a program to cut out every other line of a FLI.");
  232.    puts("   usage:  slicefli infile.fli outfile.fli"); 
  233.    exit(0); 
  234.    } 
  235. ivmode = dos_get_vmode(); 
  236. dos_set_vmode(0x13); /* To VGA/MCGA 320x200 256 color mode */ 
  237. if (dos_get_vmode() != 0x13) 
  238.    { 
  239.    puts("Not a VGA/MCGA display, sorry"); 
  240.    } 
  241. else 
  242.    { 
  243.    err = convert_fli(argv[1], argv[2]); 
  244.    if (err >= AA_SUCCESS) 
  245.       { 
  246.       fli_play(argv[2]); 
  247.       } 
  248.    dos_set_vmode(ivmode); 
  249.    if (err < AA_SUCCESS) puts(fli_error_message(err)); 
  250.    } 
  251.  
  252. /* zero out every other line of a screen */ 
  253. void slice_screen(Vscreen *s) 
  254. int i; 
  255. Pixel *p; 
  256.  
  257. p = s->p; 
  258. for (i=0; i<s->h; i+=2) 
  259.    { 
  260.    i86_bzero(p, s->bpr); 
  261.    p += 2*s->bpr; 
  262.    } 
  263.  
  264. Errval convert_fli(char *in, char *out) 
  265. Errval err = AA_SUCCESS;   /* start out optimistic! */ 
  266. Vscreen *bs; 
  267. Fli_head inhead, outhead; 
  268. Jfile infile = 0, outfile = 0; 
  269. int i; 
  270.  
  271. if ((bs = aa_alloc_mem_screen()) == NULL) 
  272.    { 
  273.    err = AA_ERR_NOMEM; 
  274.    goto EXIT; 
  275.    } 
  276. if ((infile = fli_open(in, &inhead)) < 0) 
  277.    { 
  278.    err = infile; 
  279.    goto EXIT; 
  280.    } 
  281. if ((outfile = fli_create(out, &outhead, inhead.speed)) < AA_SUCCESS) 
  282.    { 
  283.    goto EXIT; 
  284.    } 
  285. for (i=0; i<inhead.frame_count; i++) 
  286.    { 
  287.    aa_copy_screen(&aa_screen, bs); 
  288.    if ((err = fli_next_frame(infile)) < AA_SUCCESS) 
  289.       { 
  290.       goto EXIT; 
  291.       } 
  292.    slice_screen(&aa_screen); 
  293.    if ((err = fli_write_next(outfile, &outhead, &aa_screen, bs)) <
  294. AA_SUCCESS) 
  295.       { 
  296.       goto EXIT;  } 
  297.    } 
  298. if ((err = fli_end(outfile, &outhead, &aa_screen, bs)) < AA_SUCCESS) 
  299.    { 
  300.    goto EXIT; 
  301.    } 
  302. EXIT: 
  303. if (infile != 0) 
  304.    dos_close (infile); 
  305. if (outfile != 0) 
  306.    dos_close (outfile); 
  307. aa_free_mem_screen(bs); 
  308. if (err < AA_SUCCESS) 
  309.    { 
  310.    dos_delete (out); 
  311.    } 
  312. return(err); 
  313.  
  314. 3. Usage of FLI routines
  315.  
  316. 3.1 Playback Routines
  317.  
  318.      These are the main routines you will need to use to play
  319. back a FLI animation.  Note that you do not need to call some of
  320. the routines directly if you use only the high-level routines. 
  321. See the sample programs above for details.
  322.  
  323. Play a FLI on VGA screen until a key is hit. 
  324.    Errval fli_play(char *fliname) 
  325.  
  326. Play a FLI through once on VGA screen. 
  327.    Errval fli_once(char *fliname) 
  328.  
  329. Open up a FLI file,